package edu.ccut.saturn.workflow.finishTaskModule.code;


import edu.ccut.saturn.component.DefaultComponent;
import edu.ccut.saturn.component.IParameterContext;
import edu.ccut.saturn.component.SaturnData;
import edu.ccut.saturn.workflow.common.WorkFlowTools;
import edu.ccut.saturn.workflow.model.ActivityInfo;
import edu.ccut.saturn.workflow.model.WorkFlowInfo;

public class DisposeNextActivity extends DefaultComponent {
	@SuppressWarnings("unchecked")
	@Override
	public void execute(IParameterContext parameterContext) throws Exception {
//		SaturnData workFlowInstance = (SaturnData) parameterContext
//				.getParameterValue(0);
		WorkFlowInfo workFlowInfo = (WorkFlowInfo) parameterContext
				.getParameterValue(1);
//		Map<String, String> workFlowParamMap = (Map<String, String>) parameterContext
//				.getParameterValue(2);
		SaturnData currentActivityInstance = (SaturnData) parameterContext
				.getParameterValue(3);// 本次操作的活动
//		Map<String, String> customParamMap = (Map<String, String>) parameterContext
//				.getParameterValue(4);
		ActivityInfo nextActivityInfo = workFlowInfo.getActivityInfoById(workFlowInfo.getActivityInfoById(currentActivityInstance.get("activity_id")+"").getNext());
		//WorkFlowTools.checkToActivateActivity(parameterContext);
		//parameterContext.setParameter(3, currentActivityInstance);//将当前活动替换为下一活动的前一活动
		parameterContext.addParameter(null, Object.class);
		parameterContext.setParameter(5, nextActivityInfo);
		WorkFlowTools.checkToActivateActivity(parameterContext);
	}
}